import 'package:flutter/material.dart';

class LoginPage extends StatefulWidget {
  LoginPage({Key? key}) : super(key: key);

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  @override
  Widget build(BuildContext context) {
    Color color = Theme.of(context).backgroundColor;
    var height = MediaQuery.of(context).size.height - 130;
    var width = MediaQuery.of(context).size.width - 130;

    return Scaffold(
      appBar: AppBar(
        title: Text('用户登录'),
      ),
      body: SafeArea(
        child: Container(
          height: MediaQuery.of(context).size.height,
          decoration: BoxDecoration(color: Colors.green),
          child: Column(
            children: [
              Container(
                  height: height,
                  margin: EdgeInsets.all(10.0),
                  padding: EdgeInsets.all(30.0),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(20.0))),
                  child: ListView(
                    children: [
                      TextField(
                          decoration: InputDecoration(
                              icon: Icon(Icons.manage_accounts),
                              hintText: '请输入账号')),
                      Padding(padding: EdgeInsets.all(10)),
                      TextField(
                          obscureText: true,
                          decoration: InputDecoration(
                              icon: Icon(Icons.lock), hintText: '请输入密码')),
                      Padding(padding: EdgeInsets.all(10)),
                      ElevatedButton(
                        style: ButtonStyle(
                            backgroundColor:
                                MaterialStateProperty.all(Colors.green)),
                        onPressed: () {},
                        child: Container(
                          width: width,
                          child: Center(
                            child: Text(
                              '登录',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      Padding(padding: EdgeInsets.all(10)),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          GestureDetector(
                            onTap: () {
                              Navigator.of(context).pushNamed('resetpassword');
                            },
                            child: Text(
                              '忘记密码',
                              style: TextStyle(color: Colors.grey),
                            ),
                          ),
                          GestureDetector(
                            onTap: () {
                              Navigator.of(context).pushNamed('register');
                            },
                            child: Text(
                              '快速注册',
                              style: TextStyle(color: Colors.red),
                            ),
                          ),
                        ],
                      )
                    ],
                  )),
              GestureDetector(
                onTap: () {},
                child: Center(child: Text('登录代表同意使用协议和隐私政策')),
              )
            ],
          ),
        ),
      ),
    );
  }
}
